package com.yoda.mall.mysql.api;

import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yoda.mall.api.FlashPromotionSessionApi;
import com.yoda.mall.model.entity.sms.FlashPromotionSession;
import com.yoda.mall.mysql.mapper.FlashPromotionSessionMapper;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@DubboService
public class FlashPromotionSessionApiImpl implements FlashPromotionSessionApi {
    @Autowired
    private FlashPromotionSessionMapper flashPromotionSessionMapper;
    @Override
    public void createFlashPromotionSession(FlashPromotionSession flashPromotionSession) {
        flashPromotionSessionMapper.insert(flashPromotionSession);
    }

    @Override
    public void deleteFlashPromotionSessionById(Long id) {
        flashPromotionSessionMapper.deleteById(id);
    }

    @Override
    public List<FlashPromotionSession> getAllFlashPromotionSession() {
        return flashPromotionSessionMapper.selectList(null);
    }

    @Override
    public List<FlashPromotionSession> getFlashPromotionSessionsByIds(List<Long> flashPromotionSessionIds) {
        return flashPromotionSessionMapper.selectBatchIds(flashPromotionSessionIds);
    }

    @Override
    public void updateFlashPromotionSession(FlashPromotionSession flashPromotionSession) {
        flashPromotionSessionMapper.updateById(flashPromotionSession);
    }

    @Override
    public FlashPromotionSession getFlashPromotionSessionById(Long id) {
        return flashPromotionSessionMapper.selectById(id);
    }
}
